//
//  Client.h
//  tcpoctest
//
//  Created by gump on 10/18/12.
//  Copyright (c) 2012 gump. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "StreamBuffer.h"

@interface Client : NSObject
{
    int                 mSocketHandle;
    char                *mBuffer;
    NSMutableArray      *mPacketArr;
    NSMutableArray      *mSendPacketArr;
    char                *mip;
    int                 mport;
    bool                mbcloseSocket;
    pthread_mutex_t     mnetsendmutex;
    pthread_mutex_t     mnetrecivemutex;
    bool                mbreconnect;//是否重连
}

-(bool)Connect:(char *)stradd withPort:(int)port;
-(PACKET*)receive;
-(void)freePacket:(PACKET *)p;
-(void)PushPacket:(StreamBuffer *)sb;
-(PACKET*)getPopPacket;
-(char*)getBuffer;
-(int)getSocketHandle;
-(void)SendPacket;
-(void)Package:(char *)date withLength:(int)len;
-(char*)getIP;
-(int)getPort;
-(void)initializeSocket;
-(void)PackageHeartBeat;
-(void)SendQuitDirectly:(char *)quitdate;
-(bool)IsCloseSocket;
-(void)CloseSocket;
-(void)reConnect;
-(void)SetCloseSocket:(bool)isclose;
-(void)SetIsReConnect:(bool)isconnect;
-(bool)IsReConnect;

@end
